	import {ref} from "vue"
	const system = uni.getSystemInfoSync();
	export function getSystemInfo(){
		try{	
		let statusBarHeight = ref(system.statusBarHeight || 0) ;
		const {top,height} =  uni.getMenuButtonBoundingClientRect()
		let titleBarHeight = ref( (top - statusBarHeight.value) *2)
		return{
			top,height,titleBarHeight,statusBarHeight
			}
		}
		catch(e){
			return{
				top,height:40,statusBarHeight:0
				}
		}
		
	
	}
	
	export const getTitleBarHeight = ()=>{
		
		try{
			if(uni.getMenuButtonBoundingClientRect()){
				const {top,height} =  uni.getMenuButtonBoundingClientRect()
				console.log(height,top,system.statusBarHeight );
				return height+(top - system.statusBarHeight)*2
			
			}else{
				return 40
			}
		}
		catch(e){
			return 40
		}
	
	}
	
	export const getStatusBarHeight = ()=>{
		try {
			
		 return	system.statusBarHeight==0?15: system.statusBarHeight
		} catch (error) {
			//TODO handle the exception
			return 30
		}
	}
	
	export const getNavBarHeight= () =>{
		return getStatusBarHeight()+ getTitleBarHeight();
	}
	
